# # https://zhuanlan.zhihu.com/p/56922793
#
# from tool.get_hook import get_set_info
#
# args = get_set_info()
# print(args)
# import os
#
# # print(os.environ)
# import signal
# import subprocess
# import time
#
#
# def record():
#     # cmd = “scrcpy -r …/Result_screen/” + file_time + “.mp4”
#     cmd = r"scrcpy -r C:\Users\zaodao\Desktop\auto_wsy\video\test01_debug-2021_05_08-16_41_53.mp4"
#     p = subprocess.Popen(cmd, shell=True)
#     # p = os.popen(cmd)
#     #
#     time.sleep(10)
#     os.kill(p.pid, signal.CTRL_C_EVENT)
#
#     # allure.attach.file(file_path, name=file_time, attachment_type=allure.attachment_type.MP4)
#
# record()

# def debug(func):
#     def wrapper():
#         print("[DEBUG]: enter {}()".format(func.__name__))
#         return func()
#     return wrapper

def logging(level):
    def wrapper(func):
        def inner_wrapper(*args, **kwargs):
            print("[{level}]: enter function {func}()".format(
                level=level,
                func=func.__name__))
            return func(*args, **kwargs)
        return inner_wrapper
    return wrapper

@logging(level='INFO')
def say(something):
    print( "say {}!".format(something))

# 如果没有使用@语法，等同于
# say = logging(level='INFO')(say)

@logging(level='DEBUG')
def do(something):
    print("do {}...".format(something))

if __name__ == '__main__':
    say('hello')
    do("my work")